package cn.tedu.userservice.controller;

import cn.tedu.charging.common.response.JsonResult;
import cn.tedu.userservice.pojo.vo.UserVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@Slf4j
@RequestMapping("/v1/user/")
@RestController
@Api(tags = "用户模块")
public class UserController {

    @ApiOperation("获取用户车辆信息")
    @GetMapping("info/{userId}")
    public JsonResult getUserInfo(@PathVariable("userId") Long userId) {
        log.debug("C1-获取用户信息-{}",userId);
        UserVO vo = new UserVO();
        vo.setCarId(11L);
        log.debug("C1-返回数据:{}",vo);
        return JsonResult.success(vo);
    }

    @GetMapping("balancer/{userId}")
    public JsonResult<BigDecimal> getUserBanlance(@PathVariable Long userId){
        log.debug("U-1:查询用户余额:{}",userId);
        BigDecimal balance=new BigDecimal(1000);
        return JsonResult.success(balance);
    }
}
